<template>
	<div>

		<el-container style="margin-top: 30px;background-color: white; width: 1300px;">
			<el-aside width="280px" style="height: 600px;background-color: white;">

				<div class="usertou">
					<div class="usertou1"><img style="width: 95%;margin-left: 6px;margin-top: 5px;"
							src="../img/morentx.jpg"></div>
					<p style="font-size: 25px;text-align: center;">{{username}}</p>
					<el-button type="danger" @click="smrz()" 
						style="height: 10px;position: relative;left: 30%;bottom: 15px;">
						<p style="position: relative;bottom: 20px;" v-show="issmrz">实名认证</p>
						<p style="position: relative;bottom: 20px;" v-show="issmrz1">已实名认证</p>
					</el-button>
				</div>

				<div>
					<el-col :span="12" style="width: 100%;">
						<el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen"
							@close="handleClose">

							<el-menu-item index="1" style="margin-top: 20px;">
								<span slot="title">资产总览</span>
								<i class="el-icon-caret-right"></i>
							</el-menu-item>

							<el-menu-item @click="user_main()" index="2" style="margin-bottom: 20px;">
								<span slot="title">我的众筹</span>
								<i class="el-icon-caret-right"></i>
							</el-menu-item>

						</el-menu>
					</el-col>

				</div>

			</el-aside>
			<el-main style="width: 1100px;">
				<router-view></router-view>
			</el-main>
		</el-container>

	</div>
</template>

<script>
	export default {
		data(){
			return{
				userId:'',
				issmrz:'',
				issmrz1:'',
				username:''
			}
		},
		methods: {
			// 我的众筹
			user_main() {
				this.$router.push('/user_main')
			},
			// 实名认证
			async smrz() {
				this.userId = window.sessionStorage.getItem("userId")
				var param = new URLSearchParams();
				param.append('userId',this.userId)
				var res = await this.$http.post('/selectSmrzByUserIdAndRenZheng',param)
				
				if(res.data.data!=null){
					// alert(res.data.data)
					this.$message.warning('你已经实名认证成功！')
					
				}else{
				this.$router.push('/smrz')
				}
			},
			// 实名认证
			async smrz1() {
				this.userId = window.sessionStorage.getItem("userId")
				var param = new URLSearchParams();
				param.append('userId',this.userId)
				var res = await this.$http.post('/selectSmrzByUserIdAndRenZheng',param)
				
				if(res.data.data!=null){
					this.issmrz = false
					this.issmrz1= true
				}else{
					this.issmrz = true
					this.issmrz1= false
				}
				var user = window.sessionStorage.getItem("userq");
				// var user = decodeURIComponent(user1);
				this.username = user	
			}
		},
		mounted() {
			this.smrz1()
		}
	}
</script>

<style>
	.usertou {
		width: 99%;
		height: 313px;
		background-color: white;
		border: #D1C2D8 solid 1px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
		border-radius: 4px;
	}

	.usertou1 {
		width: 95%;
		height: 180px;
		margin-top: 5px;
		margin-left: 5px;
		/* background-color: #D1C2D8; */
		border: #D1C2D8 solid 1px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
		border-radius: 4px;
	}
</style>
